GActionMuxer: disconnect group signals on finalize
authorRyan Lortie <desrt@desrt.ca>
Fri, 29 Jun 2012 03:55:33 +0000 (23:55 -0400)
committerTiffany Antopolski <tiffany.antopolski@gmail.com>
Fri, 29 Jun 2012 03:57:57 +0000 (23:57 -0400)
The signals for the action group were being disconnected when the action
group was explicitly removed from the GActionMuxer but the same was not
being done when it was finalized.

This means that a change in the state of an action group that used to be
associated with a finalized GActionMuxer would result in a crash.  This
would happen for stateful application actions after closing a window.

gtk/gactionmuxer.c

index 22990a40e31f096684bd8183f0e1c555e1a5ccac..532eec4ca1300040ea9ca6256a2546086dbecfc1 100644 (file)
@@ -352,6 +352,11 @@ static void
 g_action_muxer_free_group (gpointer data)
 {
   Group *group = data;
+  gint i;
+
+  /* 'for loop' or 'four loop'? */
+  for (i = 0; i < 4; i++)
+    g_signal_handler_disconnect (group->group, group->handler_ids[i]);
 
   g_object_unref (group->group);
   g_free (group->prefix);
@@ -485,10 +490,6 @@ g_action_muxer_remove (GActionMuxer *muxer,
         g_action_muxer_action_removed (group->group, actions[i], group);
       g_strfreev (actions);
 
-      /* 'for loop' or 'four loop'? */
-      for (i = 0; i < 4; i++)
-        g_signal_handler_disconnect (group->group, group->handler_ids[i]);
-
       g_action_muxer_free_group (group);
     }
 }